using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using TiaoTaoHelper.Wtm.Models;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;

namespace HengTong.Areas._Admin.Controllers;

public partial class SysUserJobPositionController
{
    [ActionDescription("获取岗位列表")]
    [HttpGet("GetSysJobPositions")]
    public ActionResult GetSysJobPositions([FromQuery] Guid? groupId)
    {
        /*return Ok(DC.Set<SysJobPosition>()
            .CheckEqual(groupId, x => x.GroupId)
            .OrderBy(x => x.Order ?? 99.99m)
            .GetSelectListItems(Wtm, x => x.Name));*/
        
        return Ok(DC.Set<SysJobPosition>()
            .CheckEqual(groupId, x => x.GroupId)
            .OrderBy(x => x.Order ?? 99.99m)
            .Select(x => new { Value = x.ID, Text = x.Name })
            .ToList());
        
    }
}